﻿using System;

namespace PrimeNum
{
    class Program
    {
       static int GetNum()
        {
            int Num=0;
            

            Console.WriteLine("请输入一个整数：");
            Num = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("它的素数因子是：");

            if( Num == 1 )
            {
                Console.WriteLine(" 1没有素数因子！");
            }
    
            return Num;
        }

        static int Operation(int Num)
        {
             int i;
            double ONum = Math.Sqrt(Num);
            for (i = 2; i <= Num; i++)
            {
                while (Num % i == 0)
                {
                    Num /= i;
                    Console.Write(" " + i + " ");
                }

            }
            return Num;
        }
        static void Main(string[] args)
        {
            int num = GetNum();
            Operation(num);
            Console.ReadKey();
        }
    }
}
